package com.sky.myapplication.kotlin.helper

import android.content.Context
import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteOpenHelper

/**
 * Created by Min
 * Time 2021/7/12
 * Desc
 */
class DBHelper(context: Context, name: String, version: Int): SQLiteOpenHelper(context, name, null, version){

    val createSql = "create table sky(id integer primary key autoincrement, name varchar(20))"
    val updateSql = "drop table sky"

    override fun onCreate(db: SQLiteDatabase?) {
        db?.execSQL(createSql)
    }

    override fun onUpgrade(db: SQLiteDatabase?, p1: Int, p2: Int) {
        db?.execSQL(updateSql)
        onCreate(db)
    }
}